package cn.com.taiji.oospub.wechat.service.impl;

import cn.com.taiji.oospub.wechat.entity.SchoolBaseInfo;
import cn.com.taiji.oospub.wechat.mapper.SchoolBaseInfoMapper;
import cn.com.taiji.oospub.wechat.service.ISchoolBaseInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yzd
 * @since 2020-10-28
 */
@Service
public class SchoolBaseInfoServiceImpl extends ServiceImpl<SchoolBaseInfoMapper, SchoolBaseInfo> implements ISchoolBaseInfoService {
    @Autowired
    private SchoolBaseInfoMapper schoolBaseInfoMapper;

    @Override
    public SchoolBaseInfo findByProperty(String columnName, String value) {
        Map<String,Object> columnMap=new HashMap<>();
        columnMap.put(columnName, value);
        List<SchoolBaseInfo> schoolBaseInfos = schoolBaseInfoMapper.selectByMap(columnMap);
        if (schoolBaseInfos.size()>0){
            return schoolBaseInfos.get(0);
        }
        return null;
    }

    @Override
    public SchoolBaseInfo findById(String schoolId) {

        return schoolBaseInfoMapper.selectById(schoolId);
    }

}
